package cn.bytengine.stem.example.config;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class AppConfig {
    @Bean
    @ConfigurationProperties("app.props")
    public AppProps appProps() {
        return new AppProps();
    }

    public static class AppProps {
        private String name;
        private String env;

        public String getName() {
            return name;
        }

        public AppProps setName(String name) {
            this.name = name;
            return this;
        }

        public String getEnv() {
            return env;
        }

        public AppProps setEnv(String env) {
            this.env = env;
            return this;
        }

        @Override
        public String toString() {
            return "AppProps{" +
                    "name='" + name + '\'' +
                    ", env='" + env + '\'' +
                    '}';
        }
    }
}
